$OpenBSD: patch-sapi_cgi_cgi_main_c,v 1.1.1.1 2015/12/14 17:58:46 robert Exp $
--- sapi/cgi/cgi_main.c.orig.port	Sun Dec  6 14:11:02 2015
+++ sapi/cgi/cgi_main.c	Sun Dec  6 14:11:41 2015
@@ -1722,6 +1722,7 @@ int main(int argc, char *argv[])
 	char *orig_optarg = php_optarg;
 	char *script_file = NULL;
 	size_t ini_entries_len = 0;
+	char *ini;
 	/* end of temporary locals */
 
 	int max_requests = 500;
@@ -1784,7 +1785,12 @@ int main(int argc, char *argv[])
 
 	sapi_startup(&cgi_sapi_module);
 	fastcgi = fcgi_is_fastcgi();
-	cgi_sapi_module.php_ini_path_override = NULL;
+
+	if ((ini = getenv("PHP_INI_PATH"))) {
+		cgi_sapi_module.php_ini_path_override = ini;
+	} else {
+		cgi_sapi_module.php_ini_path_override = NULL;
+	}
 
 #ifdef PHP_WIN32
 	_fmode = _O_BINARY; /* sets default for file streams to binary */
